<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>高级查询</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	
	<style type="text/css">
		#xuexiao{
			color:#555;
		}
		#xuexiao:hover{
			color:#3a87ad;
		}
	</style>
</head>
<body >
		<%@include file="include/topbar.jsp" %>
		
		<div class="container" style="margin-top: 60px">
			<div class="row">
			<jsp:include page="include/left.jsp" >
				<jsp:param value="mohu" name="tag"/>
			</jsp:include>
				
			
			<div class="span9" style="min-height:500px">
				<div class="breadcrumb" style="border-radius:3px 3px 0 0;margin-bottom:0px;">
        				<h4 style="display:inline"><i class="icon-screenshot"></i>高级查询</h4>

        				
     			</div>
     			
     			
     			<div class="wall" style="padding:20px 30px;min-height:350px">
     			
     				<div class="page-header " style="margin-top:0px" >
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size:13px;font-weight:bold">题名/关键字:</span>&nbsp;
						<select class="span1" id="n2" style="margin-bottom:0px">
							<option value="mohu">模糊</option>
							<option value="jingque">精确</option>
						</select>
						<input id="name"  type="text" data-source='${namelist }' data-items="10" data-provide="typeahead" style="margin: 0 auto;" class="span4 typeahead shuru" autocomplete="off"/>
						<br /><br/>
						<select class="span1" id="a1" style="margin-bottom:0px">
							<option value="and">并且</option>
							<option value="or">或者</option>
						</select>
						<span style="font-size:13px;font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;作者:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
						<select class="span1" id="a2" style="margin-bottom:0px">
							<option value="mohu">模糊</option>
							<option value="jingque">精确</option>
						</select>
						<input id="author"  type="text" data-source='${authorlist }' data-items="10" data-provide="typeahead" style="margin: 0 auto;" class="span4 typeahead shuru" autocomplete="off"/>
						<br /><br/>
						<select class="span1" id="q1" style="margin-bottom:0px">
							<option value="and">并且</option>
							<option value="or">或者</option>
						</select>
						<span style="font-size:13px;font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;期刊:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
						<select class="span1" id="q2" style="margin-bottom:0px">
							<option value="mohu">模糊</option>
							<option value="jingque">精确</option>
						</select>
						<input id="qikan" type="text" data-source='${qnlist }' data-items="10" data-provide="typeahead" style="margin: 0 auto;" class="span4 typeahead shuru" autocomplete="off"/>
						<br /><br/>
						<select class="span1" id="t1" style="margin-bottom:0px">
							<option value="and">并且</option>
							<option value="or">或者</option>
						</select>
						<span style="font-size:13px;font-weight:bold">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类型:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
						<select class="span1" id="t2" style="margin-bottom:0px">
							<option value="mohu">模糊</option>
							<option value="jingque">精确</option>
						</select>
						<input id="type" type="text" data-source='${tnlist }' data-items="10" data-provide="typeahead" style="margin: 0 auto;" class="span4 typeahead shuru" autocomplete="off"/>
						<br /><br/>
						<select class="span1" id="i1" style="margin-bottom:0px">
							<option value="and">并且</option>
							<option value="or">或者</option>
						</select>
						<span style="font-size:13px;font-weight:bold">&nbsp;ISSN/日期:&nbsp;</span>&nbsp;
						<select class="span1" id="i2" style="margin-bottom:0px">
							<option value="jingque">精确</option>
							<option value="mohu">模糊</option>
							
						</select>
						<input id="id"  type="text" data-source='${idlist }' data-items="10" data-provide="typeahead" style="margin: 0 auto;" class="span4 typeahead shuru" autocomplete="off"/>
						&nbsp;
						<button class="btn btn-primary " id="search" style=""><i class="icon-search icon-white"></i>查询</button>
				  	</div>
     				
        			
        			
     				<table class="table table-striped table-bordered table-condensed" >
  						<thead>
  							<tr>
  								<th>文献编号</th>
  								<th>文献名</th>
  								<th>作者</th>
  								<th>分类</th>
  								<th>期刊</th>
  								<c:if test="${user.role eq 'admin' }">
  								<th id="caozuo">操作</th>
  								</c:if>
  								
  							</tr>
  						</thead>
  						<tbody id="reslut">
  							
  								
  							
  						</tbody>
					</table>
					
     			</div>
     			
			</div>	
			
			
			</div>
			</div>
			<%@include file="include/footer.jsp" %>
			
											
											
											
											 <div class="modal fade" id="del">
												   <div class="modal-header">
	    												<a class="close" data-dismiss="modal">×</a>
												    	<h4>系统提示</h4>
												    </div>
												    <div class="modal-body" style="text-align:center">
												   		<h4>确定要删除此文献么？</h4>
												    </div>
													<div class="modal-footer">
												    <a href="javascript:;" class="btn" data-dismiss="modal" >返回</a>
												    <a href="#" class="btn btn-primary" id="btn-del">确认删除</a>
												    </div>
											</div>

			<script type="text/javascript">
				 $(document).ready(function(){
					$("#search").click(function(){
						$("tbody").text("");
							var n2 = $("#n2").val();
							var name = $("#name").val().trim();
							
							var a1 = $("#a1").val();
							var author = $("#author").val().trim();
							var a2 = $("#a2").val();
							
							var t1 = $("#t1").val();
							var type = $("#type").val().trim();
							var t2 = $("#t2").val();
							
							var q1 = $("#q1").val();
							var qikan = $("#qikan").val().trim();
							var q2 = $("#q2").val();
							
							var i1 = $("#i1").val();
							var id = $("#id").val().trim();
							var i2 = $("#i2").val();
							
							if(name == ""&&author==""&&qikan==""&&type==""&&id==""){
								alert("至少有一项不为空！");
							}else{
							
							
						
							$.ajax({
								url:"gaoji.jspx",
								type:"POST",
								data:{
									n2:n2,
									name:name,
									
									a1:a1,
									author:author,
									a2:a2,
									
									t1:t1,
									type:type,
									t2:t2,
									
									q1:q1,
									qikan:qikan,
									q2:q2,
									
									i1:i1,
									id:id,
									i2:i2
									
								},
								success:function(json){
									
									$(json).each(function(){
										var tr=$("<tr>");
										var td1 = $("<td>").text(this.id);
										var name = this.name;
										var td2 = $("<td><a href='wxdetail.jspx?wid="+this.id+"'>"+name+"</a></td>");
										var td3 = $("<td width='10%'>"+this.author+"</td>");
										var td4 = $("<td>"+this.type_name+"</td>");
										var td5 = $("<td>"+this.qikan_name+"</td>");
										
										
										var a1 =$("<a href='editwenxian.jspx?wid="+this.id+"' title='修改文献' ><i class='icon-edit'></i></a>");
										var a2 = $("<a href='#del' title='删除文献' data-toggle='modal' rel='"+this.id+"' ><i class='icon-trash'></i></a>");
										var td6 =$("<td width='7%'></td>");
										a1.appendTo(td6);
										a2.appendTo(td6);
										td1.appendTo(tr);
										td2.appendTo(tr);
										td3.appendTo(tr);
										td4.appendTo(tr);
										td5.appendTo(tr);
										var b=$("th[id]").attr("id");
										if(b =="caozuo"){
											td6.appendTo(tr);
										}
										
										tr.appendTo($("tbody"));
									});
								}
							});
						}
					});
					
					
					
					
					$("a[rel]").click(function(){
						var id = $(this).attr("rel");
						$("#btn-del").attr("href","delwenxian.jspx?wid="+id);
					});
				
				}); 
			</script>
	
</body>
</html>